function fh = myhist(x,xlimit,bar_num)
% myhist(x,xlimit,bar_num)
% divides the range [XLIMIT(1),XLIMIT(2)] into BAR_NUM bars
% 
bin_width = (xlimit(2)-xlimit(1))/bar_num;
bin_center = (xlimit(1)+bin_width*0.5):bin_width:(xlimit(2)-bin_width*0.5);
[N,X] = hist(x,bin_center);
fh = bar(X,N,'BarWidth',1);
h = findobj(gca,'Type','patch');
set(h,'FaceColor','w','EdgeColor','k');